<template>
    <div class="ltheader">
        <mt-header :title="title" :fixed='true'>
            <router-link to="/" slot="left">
                <mt-button icon="back" v-show="isShow">返回</mt-button>
            </router-link>
            <router-link to="/search" slot="right">
                <mt-button>搜索</mt-button>
            </router-link>
        </mt-header>
    </div>
</template>
<script>
export default {
  data () {
    return {

    }
  },
  // 使用计算属性监听当前路由的变化
  computed: {
    title () {
      return this.$store.state.title
    },
    // 监听该页面是否是首页,不是首页则显示 ‘返回’
    isShow () {
      return !(this.$route.path === '/' || this.$route.path === '/index')
    }
  }
}
</script>
<style lang="scss" scoped>
.ltheader {
  z-index: 5998;
}
</style>
